package top.jacktgq.collection.list

/**
 @Author CandyWall
 @Date 2021/4/27--19:44
 @Description 范围
 */
def range = 1..10
println range
println range[5]
println range.contains(10)
println range.from
println range.to

// 遍历范围
range.each {
    print it
}
println ""

for (i in range) {
    print i
}
println ""

def getGrade(Number number) {
    def result
    switch (number) {
        case 0..<60:
            result = '不及格'
            break
        case 60..<70:
            result = "及格"
            break
        case 70..<80:
            result = "良好"
            break
        case 80..100:
            result = "优秀"
            break
    }
    return result
}

println getGrade(55)
println getGrade(75)
println getGrade(90)